home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / gfx / misc / dephcol.lha / dephcol / dephcol.txt < prev   
Text File  |  1999-01-06  |  2KB  |  54 lines

  1. a tiny program that convert color depth numbers to actual
  2. amount of colors, can handle 1-32 bit depth.
  3. It also have a funny comment for all colors :-)
  4.  
  5. The AmigaE sourcecode is included,
  6. and show how you can use a single normal function
  7. to do a almost silly but quick depth to color conversion.
  8.  
  9. Usage is simple just type in a shell: dephcol <depth>
  10. Where <depth> is a number from1 to 32
  11.  
  12.  
  13. And at number 31 this week,
  14. we have: "Aw shit, I think I just hit the moon up here!" ;-D
  15.  
  16. Some info on color depth:
  17. A color value consist of bits, you probably know about 8bit, 16bit gfx etc.
  18.  
  19. A bit can either be on or off (positive/negative,+ or -, you get the idea :)
  20.  
  21. Thus 1bit gfx gives 2 colors,
  22. but 2bit gfx give 4 colors.
  23. Why? because you have 2 values per bit.
  24. And 3bits gives 8 colors, 4bits gives 16 colors, 5bits gives 32,
  25. 6bits give 64, 7bits give 128, and 8bits give 256 colors, etc, etc.
  26.  
  27. If you want to do this by calculator then do the following:
  28. enter the digit 2, this is 1bit gfx.
  29. next enter multpily by 2
  30. you should get 4 (this is 2bit gfx)
  31. now multiply that value by 2 and do this as long as you want,
  32. why not note down the bits and color values,
  33. you will see that after a little while the 8th multiply you do
  34. (well 7th actually) gives the value 256 i.e: 8bit gfx = 256 colors :-)
  35.  
  36. As you can see as the amount of bits increase the amount of colors,
  37. twice relative to the previous value.
  38. Thus 1,2,3,4,5,6,7,8 bits gives 2,4,8,16,32,64,128,256 colors etc.
  39.  
  40. I'm sure the programmers out there understand what I'm getting at next,
  41. in fact I didn't realize it until recently myself.
  42. The amount of colors can be calculated by shifting bits
  43. to the left (higher) by the number of the depth.
  44.  
  45. If you don't know what I'm talking about,
  46. don't worry it's mainly ment for programmers,
  47. the rest can just say, "Wow, sounds cool." (what the heck is he saying?) :-)
  48.  
  49. Those who want too, can try the program and see it do it's work,
  50. or look in the source code as to how it's done etc.
  51. More comments are found in the source code.
  52.  
  53. Roger Hågensen <emsai@online.no>
  54.